using System;
using System.Collections.Generic;
using System.Text;

namespace CMS.Core.Domain
{
    public class CauHinhHeThong
    {
        public static readonly string MaDiaBan = System.Configuration.ConfigurationSettings.AppSettings["MaDiaBan"].ToString();
        public static readonly string TenDiaBan = System.Configuration.ConfigurationSettings.AppSettings["TenDiaBan"].ToString();
        public static readonly string UploadPath = System.Configuration.ConfigurationSettings.AppSettings["UploadPath"].ToString();
        public static readonly string AdminEmail = System.Configuration.ConfigurationSettings.AppSettings["AdminEmail"].ToString();
        public static readonly string SmtpUserPass = System.Configuration.ConfigurationSettings.AppSettings["SmtpUserPass"].ToString();
        public static readonly Int32 MaTinTuc = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["MaTinTuc"].ToString());        
        
        //public static readonly string LDAPServer = System.Configuration.ConfigurationSettings.AppSettings["LDAPServer"].ToString();
        //public static readonly string LDAPLogin = System.Configuration.ConfigurationSettings.AppSettings["LDAPLogin"].ToString();
        //public static readonly string LDAPAttribExt = System.Configuration.ConfigurationSettings.AppSettings["LDAPAttribExt"].ToString();
        //public static readonly string LDAPGroup = System.Configuration.ConfigurationSettings.AppSettings["LDAPGroup"].ToString();
        //public static readonly string LDAPAttrib = System.Configuration.ConfigurationSettings.AppSettings["LDAPAttrib"].ToString();

        //public static readonly string LoginType = System.Configuration.ConfigurationSettings.AppSettings["LoginType"].ToString();
        public static readonly string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"].ToString();        

        public static string[] ConnectionParameters{
            get
            {
                string[] Parameters = new String[4];
                String[] ArrConn = null;
                if (ConnectionString != null && !ConnectionString.Equals(String.Empty))
                    ArrConn = ConnectionString.Split(';');

                if (ArrConn != null && ArrConn.Length > 0)
                {
                    String DataSource = ArrConn[0].ToString().Replace("Data Source=", "");
                    String Database = ArrConn[1].ToString().Replace("Database=", "");
                    String UserID = ArrConn[2].ToString().Replace("User ID=", "");
                    String Password = ArrConn[3].ToString().Replace("Password=", "");
                    Parameters[0] = DataSource;
                    Parameters[1] = Database;
                    Parameters[2] = UserID;
                    Parameters[3] = Password;
                }
                return Parameters;
            }
        }
    }
}
